﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ValidationFramework.Configuration.Fluent;
using System.Text.RegularExpressions;

namespace ValidationFramework.Specifications
{
	public static class RuleCreationStepExtensions
	{
		// --- Regex
		public static DefaultSpecificationConfigurationStep<MatchesRegexSpec, TValidating> MatchesPattern<TValidating>(this RuleCreationStep<TValidating> self, string regexPattern)
		{
			var Specification = new MatchesRegexSpec(regexPattern);
			return new DefaultSpecificationConfigurationStep<MatchesRegexSpec, TValidating>(self, Specification);
		}
		public static DefaultSpecificationConfigurationStep<MatchesRegexSpec, TValidating> MatchesPattern<TValidating>(this RuleCreationStep<TValidating> self, string regexPattern, RegexOptions options)
		{
			var Specification = new MatchesRegexSpec(regexPattern, options);
			return new DefaultSpecificationConfigurationStep<MatchesRegexSpec, TValidating>(self, Specification);
		}

		// --- Required
		public static IsRequiredConfigurationStep<TValidating> IsPresent<TValidating>(this RuleCreationStep<TValidating> self)
		{
			var Specification = new IsRequiredSpec<TValidating>();
			return new IsRequiredConfigurationStep<TValidating>(self, Specification);
		}

	}
}
